package com.demo.user.util.page;

import org.apache.commons.lang3.StringUtils;

/**
 * @author xxh
 */
public enum OrderByColumnEnum {

    CREATED_AT("createdAt"),
    ;


    private String column;

    OrderByColumnEnum(String column) {
        this.column = column;
    }

    public String getColumn() {
        return column;
    }

    public static OrderByColumnEnum fromColumn(String column) {

        if (StringUtils.isBlank(column)) {
            return null;
        }
        for (OrderByColumnEnum columnEnum : OrderByColumnEnum.values()) {

            if (columnEnum.getColumn().equals(column)) {
                return columnEnum;
            }
        }
        return null;
    }
}
